package br.ufrj.ia.q3;

import java.util.LinkedHashMap;
import java.util.Map;

import aima.core.agent.Agent;
import aima.core.agent.EnvironmentState;
import br.ufrj.ia.q3.VacuumEnvironment3.LocationState3;

public class VacuumEnvironmentState3 implements EnvironmentState {

	private Map<String, VacuumEnvironment3.LocationState3> state;
	private Map<Agent, String> agentLocations;

	public VacuumEnvironmentState3() {
		state = new LinkedHashMap<String, VacuumEnvironment3.LocationState3>();
		agentLocations = new LinkedHashMap<Agent, String>();
	}

	public VacuumEnvironmentState3(VacuumEnvironment3.LocationState3 locAState,
			VacuumEnvironment3.LocationState3 locBState,
			VacuumEnvironment3.LocationState3 locCState,
			VacuumEnvironment3.LocationState3 locDState) {
		this();
		state.put(VacuumEnvironment3.LOCATION_A, locAState);
		state.put(VacuumEnvironment3.LOCATION_B, locBState);
		state.put(VacuumEnvironment3.LOCATION_C, locCState);
		state.put(VacuumEnvironment3.LOCATION_D, locDState);
	}

	public String getAgentLocation(Agent a) {
		return agentLocations.get(a);
	}

	public void setAgentLocation(Agent a, String location) {
		agentLocations.put(a, location);
	}

	public LocationState3 getLocationState(String location) {
		return state.get(location);
	}

	public void setLocationState(String location,
			VacuumEnvironment3.LocationState3 s) {
		state.put(location, s);
	}

	public String toString() {
		return state.toString();
	}
}
